package com.netdisk.service.impl;

/**
 * 分组Service
 * @author chenlong
 *2013-4-21
 */
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;

import com.netdisk.dao.impl.GroupDao;
import com.netdisk.entity.Group;
import com.netdisk.entity.Log;
import com.netdisk.service.Service;

@Component("groupService")
public class GroupService extends Service<Group>{
	
	private GroupDao  groupDao;
	
	public GroupDao getGroupDao() {
		return groupDao;
	}
	
	@Resource(name="groupDao")
	public void setGroupDao(GroupDao groupDao) {
		this.groupDao = groupDao;
	}

	@Override
	public void save(Group obj, Log log) {
		groupDao.save(obj);
		logDao.save(log);
	}

	@Override
	public void update(Group obj, Log log) {
		groupDao.update(obj);
		logDao.save(log);
	}

	@Override
	public void delete(Group obj, Log log) {
		groupDao.delete(obj);
		logDao.save(log);
	}

	@Override
	public List<Group> findAll() {
		return groupDao.findAll();
	}

	@Override
	public Group findById(String id) {
		return groupDao.findById(id);
	}

	@Override
	public List<Group> findByTop(int from, int max) {
		return groupDao.findByTop(from, max);
	}
	
	public boolean existWithGroupName(Group group ){
		return groupDao.existWithGroupName(group);
	}
}
